package net.csdn.business.mirror.service.impl;

import lombok.extern.slf4j.Slf4j;
import net.csdn.business.mirror.entity.bean.ProjectMirrorData;
import net.csdn.business.mirror.entity.bo.MirrorMqBodyBO;
import net.csdn.business.mirror.service.MqProjectChangeImplement;
import net.csdn.business.mirror.service.ProjectMirrorDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Objects;

@Slf4j
@Service
public class MqImportFailedImplement implements MqProjectChangeImplement {
    @Autowired
    private ProjectMirrorDataService projectMirrorDataService;

    @Override
    public void exec(MirrorMqBodyBO bodyBO) {
        ProjectMirrorData data = projectMirrorDataService.getByFullPath(bodyBO.getPath());
        if (Objects.isNull(data)) {
            return;
        }
        projectMirrorDataService.importFailed(data, bodyBO.getProjectId());
    }

}
